package matchs

import (
	"time"

	"gorm.io/gorm"
)

// MatchAskReceiveQuota 问问接收次数限制表（控制接收用户每日被推送上限）
type MatchAskReceiveQuota struct {
	ID         uint64         `gorm:"column:id;type:bigint unsigned;primaryKey;autoIncrement;comment:'ID'" json:"id"`
	UserID     uint64         `gorm:"column:user_id;type:bigint unsigned;not null;comment:'接收用户ID'" json:"userId"`
	Date       time.Time      `gorm:"column:date;type:date;not null;comment:'日期'" json:"date"`
	TotalQuota int8           `gorm:"column:total_quota;type:tinyint;not null;default:10;comment:'每日接收上限（默认10个）'" json:"totalQuota"`
	UsedQuota  int8           `gorm:"column:used_quota;type:tinyint;not null;default:0;comment:'已接收次数'" json:"usedQuota"`
	CreatedAt  time.Time      `gorm:"column:created_at;type:datetime;not null;default:current_timestamp;comment:'创建时间'" json:"createdAt"`
	UpdatedAt  time.Time      `gorm:"column:updated_at;type:datetime;not null;default:current_timestamp on update current_timestamp;comment:'更新时间'" json:"updatedAt"`
	DeletedAt  gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:'软删除时间'" json:"-"`
}

// TableName 自定义表名（适配框架蛇形命名规范）
func (m *MatchAskReceiveQuota) TableName() string {
	return "match_ask_receive_quota"
}

// 默认接收次数常量
const (
	DefaultAskReceiveDailyQuota = 10 // 每日最多被推送10个问问
)
